import axiosIns from '@/utils/request';
const proxyStr = '/proxy_abhd';

export const fetchBhgl = {
  parentPageList: (data) => {
    const { pageIndex = 1, pageSize = 10 } = data;
    delete data.pageIndex;
    delete data.pageSize;
    return axiosIns.post(`${proxyStr}/abhd/bhgl/queryBhglPageList`, data, {
      params: { pageIndex, pageSize }
    });
  },
  childPageList: (data) => {
    const { pageIndex = 1, pageSize = 10 } = data;
    delete data.pageIndex;
    delete data.pageSize;
    return axiosIns.post(`${proxyStr}/abhd/bhgl/queryBhglLbxxPageList`, data, {
      params: { pageIndex, pageSize }
    });
  },
  addChildItem: (data) => {
    return axiosIns.post(`${proxyStr}/abhd/bhgl/addBhglLbxx`, data);
  },
  updateParentItem: (data) => {
    return axiosIns.put(`${proxyStr}/abhd/bhgl/updateBhgl`, data);
  },
  updateChildItem: (data) => {
    return axiosIns.put(`${proxyStr}/abhd/bhgl/updateBhglLbxx`, data);
  },
  deleteChildItem: (id) => {
    return axiosIns.delete(`${proxyStr}/abhd/bhgl/deleteBhglLbxx/${id}`);
  },
  uploadIcon: (data) => {
    return axiosIns.post(`${proxyStr}/abhd/bhgl/uploadIcon`, data);
  },
  deleteIcon: (fileId) => {
    return axiosIns.delete(`${proxyStr}/abhd/bhgl/deleteIcon/${fileId}`);
  },
  allListTree: () => {
    return axiosIns.get(`${proxyStr}/abhd/bhgl/getBhglTreeList`);
  },
}